// #define DEBUG_MODE_FULL
#include "\ca\editor\Data\Scripts\dikCodes.h"

private ["_menuDef","_params","_menuName","_menuRsc","_menus"];
// _this==[_target, _menuNameOrParams]
//_target = _this select 0;
_params = _this select 1;

_menuName = "";
_menuRsc = "popup";

if (typeName _params == typeName []) then {
        if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__];};
        _menuName = _params select 0;
        _menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc};
} else {
        _menuName = _params;
};
//-----------------------------------------------------------------------------

_menus = [
        [
                ["main", mso_menuname, _menuRsc],
                [
                        ["Satellite COMs",
                        { if(call mso_fnc_hasRadio) then { call compile preprocessfilelinenumbers "base\support\modules\pxs_satcom_oa\start_satellite.sqf"} },
                        "", "", "", -1,	1, PXSsatcomACTIVE && ((getPlayerUID player) in MSO_R_Leader)]
                ]
        ]
];
//-----------------------------------------------------------------------------
_menuDef = [];
{
        if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x};
} forEach _menus;

if (count _menuDef == 0) then {
        hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this}else{""}, __FILE__];
        diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _this, __FILE__];
};

_menuDef // return value
